package com.lfy.kcat.content.controller;

import com.lfy.kcat.content.biz.DramaPublishService;
import com.lfy.kcat.content.domain.vo.DramaPublishVo;
import com.lfy.kcat.content.feign.CamundaFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.R;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * 短剧发布
 * 前端录入所有短剧信息，一次性保存数据
 *
 * @author leifengyang
 * @version 1.0
 * @date 2025/9/5 14:40
 * @description:
 */
@Slf4j
@RestController
public class PublishController {


    DramaPublishService dramaPublishService;

    @Autowired
    CamundaFeignClient camundaFeignClient;


    /**
     * Spring 推荐写法； 脱离Spring也安全写法；
     *
     * @param dramaPublishService
     */
    public PublishController(DramaPublishService dramaPublishService) {
        this.dramaPublishService = dramaPublishService;
    }

    /**
     * 短剧发布
     *
     * @return
     */
    @PostMapping("/publish")
    public R publish(@RequestBody DramaPublishVo dramaPublishVo) {
        log.info("短剧发布：内容：{}", dramaPublishVo);
        //1、保存和发布短剧； 并启动审核，并保存数据库对应关系
        Long dramaId = dramaPublishService.publishDrama(dramaPublishVo);
        //保存短剧和审核流对应的关系
        return R.ok("success");
    }
}
